<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			// 循环 来做1+2+3 ... + 10000
			// 1+2+3 + ... + 100000
			/*
			for(初始化条件;结束条件;递增条件){
				// run this code
			}
			*/
		   var i;
		   var sum = 0;
		   for (i = 1; i <= 10000;i++){
			   // console.log(i);
			   sum = sum + i;
			   // sum = 1, i = 2
			   // sum = 3,i = 3
			   // sum = 6, i = 4
			   
		   }
		   console.log(sum);
			var shopping = ['香蕉','苹果','牛奶','红牛'];
			var j;
			for (j = 0; j < shopping.length; j ++){
				// console.log(shopping[j]);
				// var htmlStr = '<h1>shopping[j]</h1>';
				var htmlStr = '<h1>'+shopping[j]+'</h1>';
				console.log(htmlStr);
				document.write(htmlStr);
			}
		</script>
	</body>
</html>
